// NjtAreaServiceImpl.java
package com.ruoyi.nongjt.service.impl;

import com.ruoyi.nongjt.domain.pojo.NjtProvince;
import com.ruoyi.nongjt.domain.pojo.NjtCity;
import com.ruoyi.nongjt.domain.pojo.NjtDistrict;
import com.ruoyi.nongjt.mapper.NjtAreaMapper;
import com.ruoyi.nongjt.service.NjtAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class NjtAreaServiceImpl implements NjtAreaService {

    @Autowired
    private NjtAreaMapper areaMapper;

    @Override
    public List<NjtProvince> getAreaTree() {
        List<NjtProvince> provinces = areaMapper.selectAllProvinces();
        // 这里可以根据需要构建完整的树形结构
        return provinces;
    }

    @Override
    public List<NjtProvince> getAllProvinces() {
        return areaMapper.selectAllProvinces();
    }

    @Override
    public List<NjtCity> getCitiesByProvinceId(Integer provinceId) {
        return areaMapper.selectCitiesByProvinceId(provinceId);
    }

    @Override
    public List<NjtDistrict> getDistrictsByCityId(Integer cityId) {
        return areaMapper.selectDistrictsByCityId(cityId);
    }
}
